package com.woniuxy.microfundservice.controller;

import com.woniuxy.bean.ResultBean;
import com.woniuxy.microfundservice.bean.AutomaticInvestment;
import com.woniuxy.microfundservice.service.AutomaticInvestmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.awt.*;

/**
 * Auther: yeyang  <br/>
 * Date: 2021/4/21 0021:上午 9:40  <br/>
 * Description:
 */
@RefreshScope
@RestController
@RequestMapping(value = "/at",produces = MediaType.APPLICATION_JSON_VALUE)
@Api("基金定投")
public class AutomaticInvestmentController {
    @Resource
    private AutomaticInvestmentService ats;

    @PostMapping("/add")
    @ApiOperation("新增定投")
    public ResultBean insertOne(@RequestBody AutomaticInvestment automaticInvestment){
        return ats.insertOne(automaticInvestment);
    }

    @GetMapping("/selectByName")
    @ApiOperation("根据人名查找")
    public ResultBean selectByName(String userName){
        return ats.selectByName(userName);
    }

    @PostMapping("/delOne")
    @ApiOperation("删除定投")
    public ResultBean delOne(@RequestBody AutomaticInvestment automaticInvestment){
        return ats.delOne(automaticInvestment);
    }


}
